﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;

namespace cogency.representation
{
    public class RNamespace
    {
        public readonly string Name;
        public readonly List<RDeclaration> Declarations = new List<RDeclaration>();

        public RNamespace(string name)
        {
            Name = name;
        }

        public override string ToString()
        {
            XElement entry = new XElement("namespace");
            entry.SetAttributeValue("name", Name);
            XElement items = new XElement("declarations");

            foreach(RDeclaration decl in Declarations)
            {
                items.Add(decl.AsXElement());
            }
            entry.Add(items);
            return entry.ToString();
        }
    }
}
